package com.micro.ai.template.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.time.LocalDateTime;
import java.util.Map;

/**
 * 执行日志实体
 *
 * @author micro-ai
 * @since 0.0.1
 */
@Data
@TableName(value = "execution_logs", autoResultMap = true)
@Schema(description = "执行日志")
public class ExecutionLog {

    @TableId(value = "id", type = IdType.ASSIGN_ID)
    @Schema(description = "主键ID")
    private String id;

    @TableField("agent_id")
    @Schema(description = "Agent ID")
    private String agentId;

    @TableField("request_id")
    @Schema(description = "请求ID")
    private String requestId;

    @TableField("input_data")
    @Schema(description = "输入数据")
    private String inputData;

    @TableField("output_data")
    @Schema(description = "输出数据")
    private String outputData;

    @TableField(value = "parameters", typeHandler = JacksonTypeHandler.class)
    @Schema(description = "参数")
    private Map<String, Object> parameters;

    @TableField("status")
    @Schema(description = "状态(SUCCESS/ERROR/TIMEOUT/CANCELLED)")
    private String status;

    @TableField("error_message")
    @Schema(description = "错误信息")
    private String errorMessage;

    @TableField("processing_time_ms")
    @Schema(description = "处理时间(毫秒)")
    private Integer processingTimeMs;

    @TableField("token_usage")
    @Schema(description = "Token使用量")
    private Integer tokenUsage;

    @TableField("model_used")
    @Schema(description = "使用的模型")
    private String modelUsed;

    @TableField("created_at")
    @Schema(description = "创建时间")
    private LocalDateTime createdAt;
}

